<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <meta http-equiv="X-UA-Compatible" content="ie=edge">
  <title>三元表达式</title>
</head>
<body>
  <script>
    function createDiv(options={}){
      let div = document.createElement("div");
      div.style.width = options.width ? options.width : "100px";
      div.style.height = options.height ? options.height : "100px";
      div.style.backgroundColor = options.backgroundColor ? options.backgroundColor : "red";
      document.body.appendChild(div);
    }
    createDiv({width:"200px",height:"200px",backgroundColor:"green"})
  </script>
</body>
</html>